/*
 * (C) 2014-2015 Alibaba Group Holding Limited
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 *
 *     __  ___   ______        ___       __          ___
 *    |  |/  /  /  __  \      /   \     |  |        /   \
 *    |  '  /  |  |  |  |    /  ^  \    |  |       /  ^  \
 *    |    <   |  |  |  |   /  /_\  \   |  |      /  /_\  \
 *    |  .  \  |  `--'  |  /  _____  \  |  `----./  _____  \
 *    |__|\__\  \______/  /__/     \__\ |_______/__/     \__\
 *
 *
 *
 */
//
// Created by KOALA TEAM on 12/19/14.
//

#import "UIDevice+KLVersion.h"

@implementation UIDevice (KLVersion)

+(float)KLSystemVersion{
    static NSString* version;
    static float versionFloat;
    if (!version) {
        version = [[UIDevice currentDevice] systemVersion];
        versionFloat = [version floatValue];
    }
    return versionFloat;
}

- (BOOL) systemVersionIsEqualTo:(NSString *)versionNo
{
    return [[self class] KLSystemVersion] == [versionNo floatValue];
}

- (BOOL) systemVersionIsGreaterThan:(NSString *)versionNo
{
    return [[self class] KLSystemVersion] > [versionNo floatValue];
}

- (BOOL) systemVersionIsGreaterThanOrEqualTo:(NSString *)versionNo
{
    return  [[self class] KLSystemVersion] >= [versionNo floatValue];
}

- (BOOL) systemVersionIsLessThan:(NSString *)versionNo
{
    return [[self class] KLSystemVersion] < [versionNo floatValue];
}

- (BOOL) systemVersionIsLessThanOrEqualTo:(NSString *)versionNo
{
    return [[self class] KLSystemVersion] <= [versionNo floatValue];
}


@end
